<html>
<head><meta charset="utf-8"><title>Inline asm · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html">Inline asm</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186228822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186228822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186228822">(Jan 21 2020 at 21:19)</a>:</h4>
<p>I'm starting the work on implementing the new <code>asm!</code> macro, but I'm not too familiar with the compiler internals.</p>



<a name="186228919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186228919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186228919">(Jan 21 2020 at 21:20)</a>:</h4>
<p>In particular the new macro needs to do quite a bit of validation of the macro arguments, and I'm not sure where in the pipeline (AST/HIR/MIR) they would fit in.</p>



<a name="186229220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186229220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186229220">(Jan 21 2020 at 21:22)</a>:</h4>
<p>Basically I need to:</p>
<ul>
<li>Validate register names ("eax") and register classes (reg) are valid for the target architecture.</li>
<li>Check that the argument to a <code>imm</code> is a constant expression. Also it must be either and integer or a float type.</li>
<li>Check that the argument to a <code>sym</code> is a <code>fn</code> or a <code>static</code>.</li>
<li>Validate the types of input/output operands against the allowed set for that register class.</li>
</ul>



<a name="186230017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230017">(Jan 21 2020 at 21:29)</a>:</h4>
<p>For <code>llvm_asm!</code> it seems that almost all of the (fairly basic) validation is in librustc_builtin_macros, and LLVM catches any remaining errors in the backend.</p>



<a name="186230093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230093">(Jan 21 2020 at 21:30)</a>:</h4>
<p>But this won't work for my case since I need type information (among other things).</p>



<a name="186230113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230113">(Jan 21 2020 at 21:30)</a>:</h4>
<p>I think you should be able to do much of the validation in expansion (probably librustc_builtin_macros). The problematic bit will be the last two bullets (type information is not yet available).</p>
<p>However, I suspect that you can expand the macro to something like the existing InlineAsm thing and then type check in librustc_typeck</p>



<a name="186230180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230180">(Jan 21 2020 at 21:31)</a>:</h4>
<p>or you can also just stuff everything into a new exprkind and do the entire validation inside typeck, but that is probably worse (you'd want to stuff a lot of spans and so forth into the expr which would be not great)</p>



<a name="186230318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230318">(Jan 21 2020 at 21:32)</a>:</h4>
<p>My current plan is to rename the existing InlineAsm to LlvmInlineAsm and reimplement InlineAsm from scratch.</p>



<a name="186230350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230350">(Jan 21 2020 at 21:33)</a>:</h4>
<p>yes, that's what I would do</p>



<a name="186230384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230384">(Jan 21 2020 at 21:33)</a>:</h4>
<p>for the type checking you can look at how e.g. <code>src/librustc_typeck/check/intrinsic.rs</code> checks intrinsic types</p>



<a name="186230485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230485">(Jan 21 2020 at 21:34)</a>:</h4>
<p>Where's a good place to stuff the inline asm helper types &amp; functions that are going to be used throughout all passes? libsyntax?</p>



<a name="186230507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230507">(Jan 21 2020 at 21:35)</a>:</h4>
<p>I would stick it in a separate helper crate</p>



<a name="186230531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230531">(Jan 21 2020 at 21:35)</a>:</h4>
<p>hm, unless I'm not following</p>



<a name="186230535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230535">(Jan 21 2020 at 21:35)</a>:</h4>
<p>what do you expect those types to contain?</p>



<a name="186230591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230591">(Jan 21 2020 at 21:36)</a>:</h4>
<p>Basically lists of every register &amp; register class for every architecture, and a bitflags! for the asm flags.</p>



<a name="186230597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230597">(Jan 21 2020 at 21:36)</a>:</h4>
<p>ah</p>



<a name="186230599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230599">(Jan 21 2020 at 21:36)</a>:</h4>
<p>librustc_target, I guess, then</p>



<a name="186230636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230636">(Jan 21 2020 at 21:36)</a>:</h4>
<p>Sounds good.</p>



<a name="186230663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186230663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186230663">(Jan 21 2020 at 21:37)</a>:</h4>
<p>I'll get started and pop back if I encounter any issues.</p>



<a name="186240798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186240798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186240798">(Jan 21 2020 at 23:45)</a>:</h4>
<p>Constant expression checking is only possible on MIR, you'll want to look at <code>promote_consts</code> and check out the logic for SIMD const args</p>



<a name="186241196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186241196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186241196">(Jan 21 2020 at 23:51)</a>:</h4>
<p>hm, my impression was that constant expression meant a literal</p>



<a name="186241205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186241205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186241205">(Jan 21 2020 at 23:51)</a>:</h4>
<p>(in which case the macro could directly parse it in)</p>



<a name="186241210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186241210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186241210">(Jan 21 2020 at 23:51)</a>:</h4>
<p>but if that's wrong, then yeah</p>



<a name="186247947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186247947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186247947">(Jan 22 2020 at 01:45)</a>:</h4>
<blockquote>
<p>hm, my impression was that constant expression meant a literal</p>
</blockquote>
<p><code>foo(42)</code> is also a "constant expression" by terminology accepted in rust (as long as <code>foo</code> is <code>const fn</code>)</p>



<a name="186247959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186247959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186247959">(Jan 22 2020 at 01:45)</a>:</h4>
<p>Anything that can be the initializer for <code>const</code> or <code>static</code> is a const expression.</p>



<a name="186248020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186248020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186248020">(Jan 22 2020 at 01:46)</a>:</h4>
<p>That being said, restricting accepted tokens in <code>asm!</code> imm would make sense too and be a conservative choice.</p>



<a name="186251092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186251092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186251092">(Jan 22 2020 at 02:54)</a>:</h4>
<blockquote>
<p>That being said, restricting accepted tokens in <code>asm!</code> imm would make sense too and be a conservative choice.</p>
</blockquote>
<p>related? <a href="https://github.com/rust-lang/rust/issues/66556#issuecomment-555723836" target="_blank" title="https://github.com/rust-lang/rust/issues/66556#issuecomment-555723836">https://github.com/rust-lang/rust/issues/66556#issuecomment-555723836</a></p>



<a name="186268599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186268599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186268599">(Jan 22 2020 at 09:24)</a>:</h4>
<p>Actually the plan is to support full constant expressions. For example I have a case where I want to pass the output of <code>mem::size_of</code> as an immediate operand.</p>



<a name="186280770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186280770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186280770">(Jan 22 2020 at 12:15)</a>:</h4>
<p>Is the AST expected to match the source code exactly? If I preprocess the asm format string in librustc_builtin_macros then the AST pretty print will have a different asm string than the original.</p>



<a name="186280870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186280870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186280870">(Jan 22 2020 at 12:16)</a>:</h4>
<p>I'm mainly talking about things like argument names:</p>
<div class="codehilite"><pre><span></span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;mov {a}, {b}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">out</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="c1">// becomes</span>
<span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;mov {0}, {1}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">out</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="186281346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186281346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186281346">(Jan 22 2020 at 12:24)</a>:</h4>
<p>Also, how can I get the current target arch from librustc_builtin_macros? I need it to parse &amp; validate the asm operands.</p>



<a name="186289981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186289981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186289981">(Jan 22 2020 at 14:18)</a>:</h4>
<p>For the AST pretty printing differently, that's probably an artifact of pretty print... I would not rely on pretty print being accurate.</p>



<a name="186290679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186290679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186290679">(Jan 22 2020 at 14:27)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> I think there's no way to get target information there just now, but you can thread it into ExtCtxt probably</p>



<a name="186291766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186291766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186291766">(Jan 22 2020 at 14:38)</a>:</h4>
<p>Alternatively I could also defer validation until target information is available...</p>



<a name="186291800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186291800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186291800">(Jan 22 2020 at 14:38)</a>:</h4>
<p>yeah, that might be easier</p>



<a name="186291802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186291802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186291802">(Jan 22 2020 at 14:39)</a>:</h4>
<p>not sure</p>



<a name="186291824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186291824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186291824">(Jan 22 2020 at 14:39)</a>:</h4>
<p>centralizing all validation until librustc_typeck could work</p>



<a name="186293702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186293702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186293702">(Jan 22 2020 at 14:59)</a>:</h4>
<p>I'm looking at typeck and it doesn't feel like the right place for checking the types of asm operands.</p>



<a name="186293838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186293838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186293838">(Jan 22 2020 at 15:00)</a>:</h4>
<p>It seems that typeck can only really express "must be this exact type" or "can be any type". What I need is "type must be one of [x, y, z...]".</p>



<a name="186293892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186293892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186293892">(Jan 22 2020 at 15:01)</a>:</h4>
<p>I think this is better done in a later pass, while leaving the type inference as "can be any type".</p>



<a name="186295515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186295515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186295515">(Jan 22 2020 at 15:16)</a>:</h4>
<p>hm, I would expect "must be one of [x, y, z,...]" to be a bunch of ors?</p>



<a name="186295519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186295519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186295519">(Jan 22 2020 at 15:16)</a>:</h4>
<p>I don't see how that'll be different later on</p>



<a name="186295529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186295529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186295529">(Jan 22 2020 at 15:16)</a>:</h4>
<p>I think you might be looking at the inference part of typeck</p>



<a name="186295536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Inline%20asm/near/186295536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Inline.20asm.html#186295536">(Jan 22 2020 at 15:17)</a>:</h4>
<p>but there are non-inference parts too</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>